package com.blb.thread;

/**
 * 饿汉式单例
 */
public class HungerSingleton {

    //饿汉式一开始就创建实例
    private static HungerSingleton instance = new HungerSingleton();

    private HungerSingleton(){
        System.out.println("创建饿汉式单例");
    }

    public static HungerSingleton getInstance(){
        return instance;
    }
}
